<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="org.huqiwen.blog.data.CategoryDataBean"%>
<%@page import="org.huqiwen.blog.data.BlogDataBean"%>
<%@page import="org.huqiwen.blog.data.LinkDataBean"%>
<jsp:useBean id="category" class="org.huqiwen.blog.logic.CategoryLogicBean"/>
<jsp:useBean id="lastUp" class="org.huqiwen.blog.logic.LastUpdateLogicBean"/>
<jsp:useBean id="link" class="org.huqiwen.blog.logic.LinkLogicBean"/>
<%
	List lastUpdateList = lastUp.lastUpdateBlog();
	List<CategoryDataBean> catList = category.findAllCategory();
	List<LinkDataBean> linkList = link.findAll();
	String username = (String)session.getAttribute("username");
%>
		<div id="parameter">
			<div id="author">
				<div class="mypic"></div>
				<!--
				<p class="mypic"><img src="mypic.jpg" /></p>
				-->
				<p>冷月的BLOG</p>
			</div>
			<div id="llinks">
				<h4><span>活力地带</span></h4>
				<ul>
					<li><a href="/MyBlogDemo/index.jsp">个人首页</a></li>
					<li><a href="/MyBlogDemo/login.jsp">控制面板</a></li>
					<li><a href="/MyBlogDemo/index.jsp">我的文章</a></li>
					<li>我的相册</li>
					<li>我的好友</li>
					<li><a href="/MyBlogDemo/Message.jsp">给我留言</a></li>
				</ul>
			</div>
			<div>
				<h4><span>文章分类</span></h4>
			</div>
			<div id="category">
				<ul>
				<%for(int i=0;i<catList.size();i++){
					CategoryDataBean catBean = (CategoryDataBean)catList.get(i);
				 %>
				<li><a href="FindByCatServlet?cat=<%=catBean.getCatName()%>"><%=catBean.getCatName()%></a></li>
				<%} %>
				</ul>
			</div>
			<div>
				<h4><span>最新文章列表</span></h4>
			</div>			
			<div id="lastUpdate">
				<ul>
				<%for(int i=0;i<lastUpdateList.size();i++){
					BlogDataBean blogBean =(BlogDataBean)lastUpdateList.get(i);
				%>
				<li><a href="FindBlogByIdServlet?id=<%=blogBean.getBlogId()%>"><%=blogBean.getBlogTitle()%></a></li>
				
				<%} %>
				</ul>
			</div>
			<div id="frendLink">
				<h4>
					<span>友情连接</span>
					<%if(username!=null){ %>
					<span class="editor"><a href="/MyBlogDemo/admin/editorLink.jsp">编辑</a></span>
					<%} %>
				</h4>
			</div>			
			<div id="linkList">
			<%if(linkList.size()!=0){
				for(int i=0;i<linkList.size();i++){
				 	LinkDataBean linkBean = (LinkDataBean)linkList.get(i);
			%>
			<div><a href="<%=linkBean.getLinkUrl()%>"><%=linkBean.getLinkName()%></a></div>
			<div><%=linkBean.getLinkDescription()%></div>
			<hr/>
			<%}}%>
			</div>
		</div>